@echo off
REM 设置下载目录，保存所有下载的文件
set "DOWNLOAD_DIR=%CD%\downloaded_files"

REM 创建下载目录
mkdir "%DOWNLOAD_DIR%"

REM 设置模拟浏览器的请求头，模拟访问网页
set "USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
set "REFERER_URL=https://sid.erda.dk/"

REM 使用 curl 获取文件列表
echo Fetching file list from the URL...
curl -o file_list.html "https://sid.erda.dk/cgi-sid/ls.py?share_id=GxrFNGtykS" -A "%USER_AGENT%" -e "%REFERER_URL%"

REM 检查是否找到 .md5 文件
findstr /i ".md5" file_list.html >nul
if %errorlevel% equ 0 (
    echo MD5 checksum file found on the server.
) else (
    echo No MD5 checksum file found on the server.
)

REM 使用 wget 下载文件，模拟浏览器请求并递归下载文件
echo Starting download of all files and folders...
wget -r -np -nH -l inf -P "%DOWNLOAD_DIR%" --user-agent="%USER_AGENT%" --referer="%REFERER_URL%" "https://sid.erda.dk/cgi-sid/ls.py?share_id=GxrFNGtykS"

REM 提示下载完成
echo Download and verification process completed. Check the %DOWNLOAD_DIR% folder.
pause
